package threadLock.threadBasics.interrupt;

/**
 * 思考 while 使用线程的interrupted 判断中断标记之后 为什么之后的中断标记会返回false
 * interrupted 是调用Thread静态的获取中断 他会重置并删除中断标记 所以之后获取会返回false
 */
public class InterruptedThread2 {
    public static void main(String[] args) throws InterruptedException {
        Thread threadOne = new Thread(() -> {
            while(!Thread.currentThread().interrupted()){}
            System.out.println("threadOne isInterrupted: " + Thread.currentThread().isInterrupted());
        });
        threadOne.start();
        threadOne.interrupt();
        threadOne.join();
        System.out.println("main thread is over");
    }
}
